package com.example.sys.controller;

import com.example.sys.model.SysUser;
import com.example.sys.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/user")
@Controller
public class SysUserController {

    @Autowired
    SysUserService sysUserService;

    @GetMapping("/list")
    @ResponseBody
    public Object list(){

        return sysUserService.list();
    }


    @GetMapping("/info/{id}")
    @ResponseBody
    public Object info(@PathVariable Long id){

        return sysUserService.getById(id);
    }

    @PostMapping("/saveOrUpdate")
    @ResponseBody
    public Object saveOrUpdate(@RequestBody SysUser sysUser){

        return sysUserService.saveOrUpdate(sysUser);
    }
}
